package com.atguigu.gmall.juc.juc;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author 陈昆昆
 * @version 1.0
 * @date 2020/5/28 17:49
 */
public class CAS {
    public static void main(String[] args) {
        AtomicInteger atomicInteger = new AtomicInteger(5);
        System.out.println(atomicInteger.compareAndSet(5, 2019)+"--"+atomicInteger.get());
        System.out.println(atomicInteger.compareAndSet(5, 2014)+"--"+atomicInteger.get());

    }
}
